clc
clear all
instrreset
% VNA=jwlong_E5071C_class.Conect('keysight','TCPIP0::192.168.100.2::5025::SOCKET');
VNA=jwlong_N9918A_class.Conect('keysight','TCPIP0::192.168.100.2::inst0::INSTR');
VNA.SetTrace('S11');

% reads=VNA.SendAndReadMessage('SENSe1:SWEep:POIN?')

read1=VNA.SendAndReadMessage('INIT:CONT OFF;*OPC?')
VNA.SendMessage('AVER:COUN 3;')
VNA.SendMessage('AVER:CLE')
VNA.SendTrigWait()

VNA.SetAutoScale()
% VNA.SendTrig()
% VNA.SendTrig()

% VNA.SendMessage('CALC:FORMat REAL\n');
% reads=VNA.SendAndReadMessage('CALC:DATA:FDATA?')
% reads=VNA.ReadTraceF;
% plot(reads.freq,reads.real)

